Telegram Group & Telegram Channel
​​Создание функций на основе других с "замороженными" параметрами

Привет, сегодня поговорим про очень важную функцию partial из пакета functools. Более подробно мы рассказываем про это в курсе, но сейчас дадим краткое описание работы.

Данная функция принимает в качестве первого аргумента любую другую функцию, а дальше параметры, которые будут автоматически переданы в эту функцию при вызове уже новой функции, которую вернёт partial.

Например, можем создать функцию, которая умножает два числа, а потом "заморозить" один аргумент, как на картинке.



tg-me.com/python_academy/76
Create:
Last Update:

​​Создание функций на основе других с "замороженными" параметрами

Привет, сегодня поговорим про очень важную функцию partial из пакета functools. Более подробно мы рассказываем про это в курсе, но сейчас дадим краткое описание работы.

Данная функция принимает в качестве первого аргумента любую другую функцию, а дальше параметры, которые будут автоматически переданы в эту функцию при вызове уже новой функции, которую вернёт partial.

Например, можем создать функцию, которая умножает два числа, а потом "заморозить" один аргумент, как на картинке.

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/76

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

Telegram Auto-Delete Messages in Any Chat

Some messages aren’t supposed to last forever. There are some Telegram groups and conversations where it’s best if messages are automatically deleted in a day or a week. Here’s how to auto-delete messages in any Telegram chat. You can enable the auto-delete feature on a per-chat basis. It works for both one-on-one conversations and group chats. Previously, you needed to use the Secret Chat feature to automatically delete messages after a set time. At the time of writing, you can choose to automatically delete messages after a day or a week. Telegram starts the timer once they are sent, not after they are read. This won’t affect the messages that were sent before enabling the feature.

How to Buy Bitcoin?

Most people buy Bitcoin via exchanges, such as Coinbase. Exchanges allow you to buy, sell and hold cryptocurrency, and setting up an account is similar to opening a brokerage account—you’ll need to verify your identity and provide some kind of funding source, such as a bank account or debit card. Major exchanges include Coinbase, Kraken, and Gemini. You can also buy Bitcoin at a broker like Robinhood. Regardless of where you buy your Bitcoin, you’ll need a digital wallet in which to store it. This might be what’s called a hot wallet or a cold wallet. A hot wallet (also called an online wallet) is stored by an exchange or a provider in the cloud. Providers of online wallets include Exodus, Electrum and Mycelium. A cold wallet (or mobile wallet) is an offline device used to store Bitcoin and is not connected to the Internet. Some mobile wallet options include Trezor and Ledger.

Python Academy from ye


Telegram Python Academy
FROM USA